﻿using App.Extension;
using Simple.BasicNet.Core;
using Simple.BasicNet.Core.Handle;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/*********************************************************
 * 命名空间 App.Pipeline
 * 接口名称 AuthenticationPipeLine
 * 开发人员：11920
 * 创建时间：2023/4/14 15:58:14
 * 描述说明：
 * 更改历史：
 * 
 * *******************************************************/
namespace App.Pipeline
{
	public class AuthenticationPipeLine : IPipeline
	{
		public bool Process(IContext context)
		{
			IDTContext IdtContext = context as IDTContext;
			if (IdtContext != null)
			{
				if (IdtContext.DeviceStatus == DeviceStatus.LoginSuccess && context.CurrentPack.CommandID != 0x10)
				{
					return true;
				}
				if (IdtContext.DeviceStatus == DeviceStatus.Unlogin && context.CurrentPack.CommandID == 0x10)
				{
					IdtContext.DeviceStatus = DeviceStatus.Logining;
					return true;
				}

			}
			return true;
		}
	}
}
